home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / bit / ginv.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  12KB  |  382 lines

  1. /*
  2.  *    compile with: cc -o ginv ginv.c -lfm_s -lgl_s -lc_s
  3.  *
  4.  *    ginv.c
  5.  *
  6.  *    ginv (Graphics Inventory)
  7.  *
  8.  *    v1.0,    May 1991
  9.  *
  10.  *    (c) 1991 Rodney Hoinkes
  11.  *    Centre for Landscape Research
  12.  *    University of Toronto
  13.  *    rodney@dgp.utoronto.ca
  14.  *
  15.  *      hacked by TC to give slightly more info.
  16.  *
  17.  *    This software is released under the conventions of
  18.  *    'anyware', meaning you can put it anyware, do anything,
  19.  *    or rm it as you please as long as you don't try to
  20.  *    get money for it (good luck if you want to try!).
  21.  *
  22.  *    This software was written to test out the getgdesc
  23.  *    function and to see what different hardware configurations
  24.  *    look like to a graphics program that really wants to know.
  25.  *  The following data was gathered from some machines I have
  26.  *    access to for general info.  
  27.  *
  28.  *    stripping the executable will greatly reduce its size
  29.  *    strip ginv
  30.  *
  31.  *    If there is interest, I am working on a version to inform
  32.  *    the make process.
  33.  *
  34.  *    A machine-independent version of psgl (GL->Postscript) is also
  35.  *    in the debugging stages since the current GL implementation
  36.  *    differs depending which machine you compile on, not just what
  37.  *    parameter set you use. This version does not require compile
  38.  *    definitions, but determines machine at run-time.
  39.  *
  40.  *    If you have another type of
  41.  *    machine NOT listed here, please email me the output from
  42.  *    this program.
  43.  *
  44.  *    IRIS 4D/20TG
  45.  *
  46.  *    IRIS 4D Graphics Inventory (ginv v1.0)
  47.  *    --------------------------------------
  48.  *    Machine: 4DPIT running IRIX version 3.3
  49.  *    1 Screen(s) Accessible on this machine.
  50.  *    
  51.  *    Screen Resolution:  1280 x 1024 pixels.
  52.  *    Zbuffer Resolution: 0xFF800000 min  0x7FFFFF max.
  53.  *    No Accumulation Buffer present.
  54.  *    Alpha bitplanes in DoubleBuffered: 0, SingleBuffered: 0
  55.  *    Red   bitplanes in DoubleBuffered: 4, SingleBuffered: 8
  56.  *    Green bitplanes in DoubleBuffered: 4, SingleBuffered: 8
  57.  *    Blue  bitplanes in DoubleBuffered: 4, SingleBuffered: 8
  58.  *    Zbuffer  bitplanes present: 24
  59.  *    Stencil  bitplanes present: 0
  60.  *    Overlay  bitplanes present: 4
  61.  *    PopUp    bitplanes present: 4
  62.  *    Underlay bitplanes present: 4
  63.  *    User-defined Clipping Planes present: 0
  64.  *    antialiased points available in colormap
  65.  *    antialiased points not available in RGB
  66.  *    antialiased lines available in colormap
  67.  *    antialiased lines not available in RGB
  68.  *    antialiased polygons not available in RGB
  69.  *    Number of verticies per polygon allowed: 256.
  70.  *    
  71.  *    FUNCTIONS AVAILABLE:
  72.  *    logicop, readsource AUTO/FONT/BACK, readsource ZBUFFER, subpixel points, subpixel lines, subpixel po
  73.  *    lygons. 
  74.  *    
  75.  *    FUNCTIONS NOT AVAILABLE:
  76.  *    afunction, fogvertex, two-sided lighting, blendfunction, scrbox, stereo, texture-mapping, polymode, 
  77.  *    64x64 patterns. 
  78.  *
  79.  *    IRIS 4D/70GT w/Alpha Planes
  80.  *
  81.  *    IRIS 4D Graphics Inventory (ginv v1.0)
  82.  *    --------------------------------------
  83.  *    Machine: 4DGT running IRIX version 3.3
  84.  *    1 Screen(s) Accessible on this machine.
  85.  *    
  86.  *    Screen Resolution:  1280 x 1024 pixels.
  87.  *    Zbuffer Resolution: 0x0 min  0x7FFFFF max.
  88.  *    No Accumulation Buffer present.
  89.  *    Alpha bitplanes in DoubleBuffered: 8, SingleBuffered: 8
  90.  *    Red   bitplanes in DoubleBuffered: 8, SingleBuffered: 8
  91.  *    Green bitplanes in DoubleBuffered: 8, SingleBuffered: 8
  92.  *    Blue  bitplanes in DoubleBuffered: 8, SingleBuffered: 8
  93.  *    Zbuffer  bitplanes present: 23
  94.  *    Stencil  bitplanes present: 0
  95.  *    Overlay  bitplanes present: 4
  96.  *    PopUp    bitplanes present: 2
  97.  *    Underlay bitplanes present: 4
  98.  *    User-defined Clipping Planes present: 0
  99.  *    antialiased points available in colormap
  100.  *    antialiased points available in RGB
  101.  *    antialiased lines available in colormap
  102.  *    antialiased lines available in RGB
  103.  *    antialiased polygons not available in RGB
  104.  *    Number of verticies per polygon allowed: 256.
  105.  *    
  106.  *    FUNCTIONS AVAILABLE:
  107.  *    blendfunction, readsource AUTO/FONT/BACK, readsource ZBUFFER, subpixel points, subpixel lines. 
  108.  *    
  109.  *    FUNCTIONS NOT AVAILABLE:
  110.  *    afunction, logicop, fogvertex, two-sided lighting, scrbox, subpixel polygons, stereo, texture-mappin
  111.  *    g, polymode, 64x64 patterns. 
  112.  *
  113.  *    IRIS 4D/310VGX - 5span
  114.  *
  115.  *    IRIS 4D Graphics Inventory (ginv v1.0)
  116.  *    --------------------------------------
  117.  *    Machine: 4DVGX running IRIX version 3.3
  118.  *    1 Screen(s) Accessible on this machine.
  119.  *    
  120.  *    Screen Resolution:  1280 x 1024 pixels.
  121.  *    Zbuffer Resolution: 0xFF800000 min  0x7FFFFF max.
  122.  *    Software Accumulation Buffer with 16 bitplanes per colour component.
  123.  *    Alpha bitplanes in DoubleBuffered: 8, SingleBuffered: 8
  124.  *    Red   bitplanes in DoubleBuffered: 8, SingleBuffered: 8
  125.  *    Green bitplanes in DoubleBuffered: 8, SingleBuffered: 8
  126.  *    Blue  bitplanes in DoubleBuffered: 8, SingleBuffered: 8
  127.  *    Zbuffer  bitplanes present: 24
  128.  *    Stencil  bitplanes present: 8
  129.  *    Overlay  bitplanes present: 8
  130.  *    PopUp    bitplanes present: 2
  131.  *    Underlay bitplanes present: 8
  132.  *    User-defined Clipping Planes present: 6
  133.  *    antialiased points available in colormap
  134.  *    antialiased points available in RGB
  135.  *    antialiased lines available in colormap
  136.  *    antialiased lines available in RGB
  137.  *    antialiased polygons available in RGB
  138.  *    Number of verticies per polygon allowed: 256.
  139.  *    
  140.  *    FUNCTIONS AVAILABLE:
  141.  *    afunction, logicop, fogvertex, two-sided lighting, blendfunction, readsource AUTO/FONT/BACK, readsou
  142.  *    rce ZBUFFER, scrbox, subpixel points, subpixel lines, subpixel polygons, stereo, texture-mapping, po
  143.  *    lymode. 
  144.  *    
  145.  *    FUNCTIONS NOT AVAILABLE:
  146.  *    64x64 patterns. 
  147.  *
  148.  */
  149. #include <stdio.h>
  150. #include <string.h>
  151. #include <stdlib.h>
  152. #include "gl/gl.h"
  153. #include "gl/device.h"
  154. #include "fmclient.h"
  155.  
  156. main(argc,argv)
  157. int argc;
  158. char *argv[];
  159. {
  160.     register int i,j,c;
  161.     short machinetype;
  162.     float softversion;
  163.     char version[40],software[6],machine[6];
  164.     char buf[60][255];
  165.     char opbuf[60][40], yes[4000], no[4000];
  166.     char op[60];
  167.     char showfonts = 0;
  168.  
  169.     /* check commandline parameters */
  170.     if(argc == 2) {
  171.         if(!strcmp(argv[1],"-h")) {
  172.             printf("usage: %s [-h] [-f]\n",argv[0]);
  173.             printf("\t-h\tThis help menu.\n");
  174.             printf("\t-f\tShow list of installed fonts.\n");
  175.             exit(1);
  176.         }
  177.         else if(!strcmp(argv[1],"-f")) showfonts = 1;
  178.     }
  179.     /* open program window and setup display settings */
  180.     noport();
  181.  
  182.     foreground();
  183.     winopen("SetupCheck");
  184.     gconfig();
  185.  
  186.     /* get machine information */
  187.     gversion(version);
  188.     for(i=2;i<strlen(version);++i){
  189.         if(version[i]=='-') break;
  190.         machine[i-2]=version[i];
  191.     }
  192.     machine[i-2]='\0';
  193.     software[0]=version[i+1];
  194.     software[1]=version[i+2];
  195.     software[2]=version[i+3];
  196.     software[3]='\0';
  197.     softversion = atof(software);
  198.  
  199.     printf("IRIS 4D Graphics Inventory (ginv v1.0)\n");
  200.     printf("--------------------------------------\n");
  201.     printf("Machine: %s running IRIX version %s\n",machine,software);
  202.  
  203.     printf("%d Screen(s) Accessible on this machine.\n\n",getgdesc(GD_NSCRNS));
  204.  
  205.     i = 0;
  206.     sprintf(buf[i++],"Screen Resolution:  %d x %d pixels.",getgdesc(GD_XPMAX),getgdesc(GD_YPMAX));
  207.     sprintf(buf[i++],"Zbuffer Resolution: 0x%X min  0x%X max.",getgdesc(GD_ZMIN),getgdesc(GD_ZMAX));
  208.  
  209.     if(getgdesc(GD_BITS_ACBUF_HW))
  210.         sprintf(buf[i++],"Hardware Accumulation Buffer with %d bitplanes per colour component.",getgdesc(GD_BITS_ACBUF_HW));
  211.     else if(getgdesc(GD_BITS_ACBUF))
  212.         sprintf(buf[i++],"Software Accumulation Buffer with %d bitplanes per colour component.",getgdesc(GD_BITS_ACBUF));
  213.     else
  214.         strcpy(buf[i++],"No Accumulation Buffer present.");
  215.  
  216.     sprintf(buf[i++],"Alpha bitplanes in DoubleBuffered: %d, SingleBuffered: %d",getgdesc(GD_BITS_NORM_DBL_ALPHA),getgdesc(GD_BITS_NORM_SNG_ALPHA));
  217.     sprintf(buf[i++],"Red   bitplanes in DoubleBuffered: %d, SingleBuffered: %d",getgdesc(GD_BITS_NORM_DBL_RED),getgdesc(GD_BITS_NORM_SNG_RED));
  218.     sprintf(buf[i++],"Green bitplanes in DoubleBuffered: %d, SingleBuffered: %d",getgdesc(GD_BITS_NORM_DBL_GREEN),getgdesc(GD_BITS_NORM_SNG_GREEN));
  219.     sprintf(buf[i++],"Blue  bitplanes in DoubleBuffered: %d, SingleBuffered: %d",getgdesc(GD_BITS_NORM_DBL_BLUE),getgdesc(GD_BITS_NORM_SNG_BLUE));
  220.     sprintf(buf[i++],"cmap  bitplanes in DoubleBuffered: %d, SingleBuffered: %d",getgdesc(GD_BITS_NORM_DBL_CMODE),getgdesc(GD_BITS_NORM_SNG_CMODE));
  221.     sprintf(buf[i++],"Zbuffer  bitplanes present: %d",getgdesc(GD_BITS_NORM_ZBUFFER));
  222.     sprintf(buf[i++],"Stencil  bitplanes present: %d",getgdesc(GD_BITS_STENCIL));
  223.     sprintf(buf[i++],"Overlay  bitplanes present: %d",getgdesc(GD_BITS_OVER_SNG_CMODE));
  224.     sprintf(buf[i++],"PopUp    bitplanes present: %d",getgdesc(GD_BITS_PUP_SNG_CMODE));
  225.     sprintf(buf[i++],"Underlay bitplanes present: %d",getgdesc(GD_BITS_UNDR_SNG_CMODE));
  226.     sprintf(buf[i++],"Cursor bitplanes present: %d",getgdesc(GD_BITS_CURSOR));
  227.     sprintf(buf[i++],"User-defined Clipping Planes present: %d",getgdesc(GD_CLIPPLANES));
  228.     if(getgdesc(GD_PNTSMOOTH_CMODE))
  229.         sprintf(buf[i++],"antialiased points available in colormap");
  230.     else
  231.         sprintf(buf[i++],"antialiased points not available in colormap");
  232.     if(getgdesc(GD_PNTSMOOTH_RGB))
  233.         sprintf(buf[i++],"antialiased points available in RGB");
  234.     else
  235.         sprintf(buf[i++],"antialiased points not available in RGB");
  236.     if(getgdesc(GD_LINESMOOTH_CMODE))
  237.         sprintf(buf[i++],"antialiased lines available in colormap");
  238.     else
  239.         sprintf(buf[i++],"antialiased lines not available in colormap");
  240.     if(getgdesc(GD_LINESMOOTH_RGB))
  241.         sprintf(buf[i++],"antialiased lines available in RGB");
  242.     else
  243.         sprintf(buf[i++],"antialiased lines not available in RGB");
  244.     if(getgdesc(GD_POLYSMOOTH))
  245.         sprintf(buf[i++],"antialiased polygons available in RGB");
  246.     else
  247.         sprintf(buf[i++],"antialiased polygons not available in RGB");
  248.     if(getgdesc(GD_NVERTEX_POLY) == GD_NOLIMIT)
  249.         sprintf(buf[i++],"Number of verticies per polygon allowed: Unlimited.");
  250.     else
  251.         sprintf(buf[i++],"Number of verticies per polygon allowed: %d.",getgdesc(GD_NVERTEX_POLY));
  252.  
  253.     j = 0;
  254.     sprintf(opbuf[j],"afunction");
  255.     if(getgdesc(GD_AFUNCTION))
  256.         op[j++] = 1;
  257.     else
  258.         op[j++] = 0;
  259.  
  260.     sprintf(opbuf[j],"logicop");
  261.     if(getgdesc(GD_LOGICOP))
  262.         op[j++] = 1;
  263.     else
  264.         op[j++] = 0;
  265.  
  266.     sprintf(opbuf[j],"fogvertex");
  267.     if(getgdesc(GD_FOGVERTEX))
  268.         op[j++] = 1;
  269.     else
  270.         op[j++] = 0;
  271.  
  272.     sprintf(opbuf[j],"two-sided lighting");
  273.     if(getgdesc(GD_LIGHTING_TWOSIDE))
  274.         op[j++] = 1;
  275.     else
  276.         op[j++] = 0;
  277.  
  278.     sprintf(opbuf[j],"blendfunction");
  279.     if(getgdesc(GD_BLEND))
  280.         op[j++] = 1;
  281.     else
  282.         op[j++] = 0;
  283.  
  284.     sprintf(opbuf[j],"readsource AUTO/FONT/BACK");
  285.     if(getgdesc(GD_READSOURCE))
  286.         op[j++] = 1;
  287.     else
  288.         op[j++] = 0;
  289.  
  290.     sprintf(opbuf[j],"readsource ZBUFFER");
  291.     if(getgdesc(GD_READSOURCE_ZBUFFER))
  292.         op[j++] = 1;
  293.     else
  294.         op[j++] = 0;
  295.  
  296.     sprintf(opbuf[j],"scrbox");
  297.     if(getgdesc(GD_SCRBOX))
  298.         op[j++] = 1;
  299.     else
  300.         op[j++] = 0;
  301.  
  302.     sprintf(opbuf[j],"subpixel points");
  303.     if(getgdesc(GD_SUBPIXEL_PNT))
  304.         op[j++] = 1;
  305.     else
  306.         op[j++] = 0;
  307.  
  308.     sprintf(opbuf[j],"subpixel lines");
  309.     if(getgdesc(GD_SUBPIXEL_LINE))
  310.         op[j++] = 1;
  311.     else
  312.         op[j++] = 0;
  313.  
  314.     sprintf(opbuf[j],"subpixel polygons");
  315.     if(getgdesc(GD_SUBPIXEL_POLY))
  316.         op[j++] = 1;
  317.     else
  318.         op[j++] = 0;
  319.  
  320.     sprintf(opbuf[j],"stereo");
  321.     if(getgdesc(GD_STEREO))
  322.         op[j++] = 1;
  323.     else
  324.         op[j++] = 0;
  325.  
  326.     sprintf(opbuf[j],"texture-mapping");
  327.     if(getgdesc(GD_TEXTURE))
  328.         op[j++] = 1;
  329.     else
  330.         op[j++] = 0;
  331.  
  332.     sprintf(opbuf[j],"polymode");
  333.     if(getgdesc(GD_POLYMODE))
  334.         op[j++] = 1;
  335.     else
  336.         op[j++] = 0;
  337.  
  338.     sprintf(opbuf[j],"64x64 patterns");
  339.     if(getgdesc(GD_PATSIZE_64))
  340.         op[j++] = 1;
  341.     else
  342.         op[j++] = 0;
  343.  
  344.  
  345.  
  346.     for(c=0;c<j;++c) {
  347.         if(op[c]) {
  348.             strcat(yes,opbuf[c]);
  349.             strcat(yes,", ");
  350.         } else {
  351.             strcat(no,opbuf[c]);
  352.             strcat(no,", ");
  353.         }
  354.     }
  355.  
  356.     for(c=0;c<i;++c) puts(buf[c]);
  357.  
  358.     yes[strlen(yes)-2] = '.';
  359.     no[strlen(no)-2] = '.';
  360.     printf("\nFUNCTIONS AVAILABLE:\n");
  361.     puts(yes);
  362.     printf("\nFUNCTIONS NOT AVAILABLE:\n");
  363.     puts(no);
  364.  
  365. /* some C info */
  366.  
  367.         printf("\nSizeof(short) =%u\t Sizeof(int)=%u\t Sizeof(long)=%d\n",
  368.                 sizeof(short), sizeof(int), sizeof(long));
  369.  
  370.         printf("Sizeof(void *)=%u\t sizeof(void **)=%d\n",
  371.                sizeof(void *), sizeof(void **));
  372.         printf("Sizeof(long *)=%u\t Sizeof(long **)=%d\n",
  373.                sizeof(long **), sizeof(long **));
  374.  
  375.         fminit();
  376.     if(showfonts) {
  377.         printf("\nINSTALLED FONTS\n\n");
  378.         fmenumerate(puts);
  379.     }
  380. return 0;
  381. }
  382.